#ifndef _Objects_h
#define _Objects_h


#include <SFML/Graphics.hpp>



enum Directions
{
	DIR_UP,
	DIR_LEFT,
	DIR_DOWN,
	DIR_RIGHT
};





//Define animation Frames
typedef struct
{
	int start;
	int end;

	float speed;

} Animation_Frames;




//Base Class Objects
class Objects : public sf::Sprite
{
	public:
			 Objects();
            

			// virtual void Animation_Update();
			 bool Load_Image(std::string img_location);


			 //Update Tiles for the Object based of 
			 //Classes Parameters
			 int Tile_Update();


			 int Get_State() { return state; }
			 void Set_State(int sState) { state = sState; }

			 //Velocity Setters n' getters
			 sf::Vector2f Get_Velocity() { return velocity; }
			 void Set_Velocity(sf::Vector2f new_velocity) { velocity = new_velocity; }

			 void Set_Velocity(float x_vel, float y_vel)
			 {
				 velocity.x = x_vel;
				 velocity.y = y_vel;
			 }


			//Get/Set Name
			std::string Get_Name() { return name; }
			void Set_Name(std::string new_name) { name = new_name; }


			 //Get/Set speed
			virtual float Get_Speed() { return speed; }
			virtual void Set_Speed(float new_speed) { speed = new_speed; }
			


			//Handle Rotation and Angle of Object
			 float Get_Angle() { return angle; }

			 void Rotate_Angle( float sAngle )
			 {
				 Set_Angle(angle += sAngle);
			 }

			 void  Set_Angle(float sAngle) 
			 { 
				 angle = sAngle; 
				 //Clamp value to the 0 - 360 range
				 if(angle > 359) { angle = 0; }
				 else if(angle < 0) { angle = 359; }

				 SetRotation(angle);
			 }



			 //Get Counter/Frame
			 float Get_Counter() { return counter; }
			 int   Get_Frame() { return frame; }

	
			 bool Is_OnScreen();

			 //Get/Set's Tile_Size
			 sf::Vector2f Get_TileSize() { return tile_size; }
			 void Set_TileSize(sf::Vector2f new_size) { tile_size = new_size; }
			 void Set_TileSize( int width, int height) 
			 {
				 tile_size.x = width;
				 tile_size.y = height;
			 }



			 //Get Render Windowz!!!
			// static sf::RenderWindow* Get_RenderWindow();
			 //static void Set_RenderWindow(sf::RenderWindow& App);


			 sf::Vector2f velocity, tile_size;

             float speed;
			 float max_speed;
         
             Directions h_direction, v_direction;
			 

			 //Get object properties from cnfig file
			 //Each derived class can implement this on their own
			// virtual bool Get_Properties(std::string cfg_loc) = 0;
            
			 //Must be public or else
			 //bullets don't work properly
			sf::Image *img;


			float angle;

			int state;
			
		std::string name;
	protected:

		//Get App reference
		//static sf::RenderWindow *p_App;

		

					 
		//sf::Image Image;

		//Name of object

		//shit for animations
        int frame;
        float counter;

		
		
};
	


#endif